<?php

require_once('c_struct.php');

class sHouse extends cStruct
{
    /**
     * @var string
     */
    public $location;
    /**
     * @var array content type: sRoomers
     */
    public $roomers;

    public function __construct($values = NULL)
    {
        parent::__construct($values);
    }
}

class sRoomer extends cStruct
{
    /**
     * @var string
     */
    public $name;
    /**
     * Secondary house
     * @var mixed sHouse, NULL
     */
    public $secHouse;

    public function __construct($values = NULL)
    {
        parent::__construct($values);
    }
}

//------------------------------------------------------------------------------

//----------------------
$house1 = new sHouse(array('location' => 'South Park', 'roomers' => array()));

$house2 = new sHouse();
$house2->location   = 'New York';
$house2->roomers    = array();

//----------------------
$roomer1 = new sRoomer(array('name' => 'Stan', 'secHouse' => $house2));
$roomer1->secHouse = $house2;

$roomer2 = new sRoomer(array('name' => 'Cartman', 'secHouse' => NULL));

//----------------------
$house1->roomers[] = $roomer1;
$house1->roomers[] = $roomer2;

print_r($house1);

# EOF